<template>
	<view class="container">
		<view class="panel-header padding-top solid-bottom">
			<view class="g-goBack" @click="$utils.toBack()">
				<view class="cuIcon-back"></view>
			</view>
			<view class="text-cut">{{info.name}}</view>
		</view>
		<scroll-view scroll-x="true" class="bg-white nav">
			<view class="flex text-center">
				<view class="cu-item flex-sub" :class="index == tabIndex?'text-orange cur':''"
					v-for="(item,index) in tabListData" :key="index" @click="bindTabChange(index)">
				{{item}}
				</view>
			</view>
		</scroll-view>
		<view v-if="tabIndex == 0">
			<view class="panel-body padding bg-white margin-top-sm">
				<view class="flex justify-between margin-top">
					<view>ID</view>
					<view>{{info.id}}</view>
				</view>
				<view class="flex justify-between margin-top">
					<view>支付账号组</view>
					<view>{{info.name}}</view>
				</view>
				<view class="flex justify-between margin-top">
					<view>微信自动转账</view>
					<view v-if="info.wxTransfer">启用</view>
					<view v-else>关闭</view>
				</view>
				<view class="flex justify-between margin-top">
					<view>微信转账APP类型</view>
					<view>{{info.wxTransferAppTypeName || '---'}}</view>
				</view>
				<view class="flex justify-between margin-top">
					<view>微信转账APP名称</view>
					<view>{{info.wxTransferAppName || '---'}}</view>
				</view>
				<view class="flex justify-between margin-top">
					<view>创建时间</view>
					<view>{{info.createDate}}</view>
				</view>
			</view>
			<view class="foot"><text class="ftxt">我也是有底线的</text></view>
		</view>
		<!-- 网点列表 -->
		<view class="panel-body padding bg-white margin-top-sm" v-if="tabIndex == 1">
			<view class="flex justify-between margin-top">
				<view>代理提现</view>
				<view v-if="info.canTransfer">启用</view>
				<view v-else>关闭</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>每日最大提现金额</view>
				<view>{{info.dayTotalMoneyStr}}元</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>单笔提现</view>
				<view>{{info.transferConfig.minMoneyStr}} - {{info.transferConfig.maxMoneyStr}}元</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>每人每天最大提现</view>
				<view>{{info.transferConfig.dayUserMaxMoneyStr}}元</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>自动审核金额</view>
				<view>{{info.transferConfig.autoMaxMoneyStr}}元</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>提现服务费</view>
				<view>{{info.transferConfig.serviceCharge}}%</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>提现时间</view>
				<view>{{info.transferConfig.cashWithdrawalTimes}}</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>每月提现日</view>
				<view>{{info.transferConfig.monthStartDay}} - {{info.transferConfig.monthEndDay}}号</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>提现周</view>
				<view>
					<view v-for="(item,index) in info.transferConfig.cashWithdrawalWeeks" :key="index">
						<text v-if="index <= 3">{{item}}</text>
					</view>
					<view v-for="(item,index) in info.transferConfig.cashWithdrawalWeeks" :key="index">
						<text v-if="index > 3">{{item}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="panel-body padding bg-white margin-top-sm" v-if="tabIndex == 2">
			<view class="flex justify-between margin-top">
				<view>会员提现</view>
				<view v-if="info.memberCanTransfer">启用</view>
				<view v-else>关闭</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>每日最大提现金额</view>
				<view>{{info.memberDayTotalMoneyStr}}元</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>单笔提现</view>
				<view>{{info.memberTransferConfig.minMoneyStr}} - {{info.memberTransferConfig.maxMoneyStr}}元</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>每人每天最大提现</view>
				<view>{{info.memberTransferConfig.dayUserMaxMoneyStr}}元</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>自动审核金额</view>
				<view>{{info.memberTransferConfig.autoMaxMoneyStr}}元</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>提现服务费</view>
				<view>{{info.memberTransferConfig.serviceCharge}}%</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>提现时间</view>
				<view>{{info.memberTransferConfig.cashWithdrawalTimes}}</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>每月提现日</view>
				<view>{{info.memberTransferConfig.monthStartDay}} - {{info.memberTransferConfig.monthEndDay}}号</view>
			</view>
			<view class="flex justify-between margin-top">
				<view>提现周</view>
				<view>
					<view v-for="(item,index) in info.memberTransferConfig.cashWithdrawalWeeks" :key="index">
						<text v-if="index <= 3">{{item}}</text>
					</view>
					<view v-for="(item,index) in info.memberTransferConfig.cashWithdrawalWeeks" :key="index">
						<text v-if="index > 3">{{item}}</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const wx = require('@/js_sdk/jweixin.js'); 
	export default {
		data() {
			return {
				info:{
					id:null,
					name:'支付账号组'
				},
				tabListData:["基础信息","代理提现配置","会员提现配置"],
				tabLoadState:[0,0,0,0,0],				//tab加载状态，第一次切换时修改为1，后面判断是否为1，如果为1则不进行加载
				tabIndex:0,
				
				lastRequestTimes:null
			};
		},
		onLoad(option) {
			this.info.id = option.id;
			this._loadInfo();
		},
		onShow(){
			this.tabLoadState = [0,0,0,0,0];
			if(this.tabIndex == 3){
				this.tabLoadState[this.tabIndex] = 1;
				this.deviceListData = [];
				this.devicePageNo = 1;
				this._loadDeviceListData();
			}else if(this.tabIndex == 4){
				this.tabLoadState[this.tabIndex] = 1;
				this._loadBusiConfigList();
			}
		},
		methods:{
			_loadInfo:function(){
				if(this.info.id){
					uni.showLoading({
						title:'加载中...'
					})
					const _self = this;
					const api = this.$request;
					api.post(api.url.pay_account_info,{
						id:this.info.id
					},res=>{
						console.log(res);
						uni.hideLoading();
						if(res.code==200){
							_self.info = res.body;
						}else if(res.msg){
							uni.showModal({
								content:res.msg,
								showCancel:false,
								complete:function(){
									uni.navigateBack();
								}
							});
						}else {
							uni.showToast({
								title:'获取数据失败',
								icon:'error'
							});
							setTimeout(function(){
								uni.navigateBack();
							},1000);
						}
					})
				}else{
					uni.showToast({
						title:'参数错误',
						icon:'error'
					});
					setTimeout(function(){
						uni.navigateBack();
					},1000);
				}
			},
			bindTabChange:function(index){
				this.tabIndex = index;
			}
		}
		
	}
</script>

<style lang="less">
.container {position:relative;height:100vh;}
.container .panel-header{height:90rpx;width:100vw;font-size:28rpx;background-color:#fff;}
.container .panel-header .text-cut{width:75%;margin:auto;text-align:center;}

.container .panel-body image{width:200rpx;height:200rpx;}
.container .panel-body .user-info{width:62vw;}

.busi-type-panel .cu-bar{position:absolute;bottom:0;left:0;right:0;}

.list-body scroll-view{height:85vh;}
.list-body .cu-card.article>.cu-item .content{padding:0;}
.list-body .cu-card.article>.cu-item .content>image{width:180rpx;height:180rpx;}
.list-body .cu-card.article>.cu-item .content .info{width:70%;}
.list-body .cu-card.article>.cu-item{margin-bottom:0;padding-bottom:0;font-size:26rpx;}

.list-body .cu-card>.cu-item .btn-info{position:absolute;top:0;right:0;border:0;font-size:42rpx;}
.list-body .cu-card>.cu-item .btn-info::after{border:0;}

.list-body .cu-card>.cu-item{position:relative;}
.list-body .cu-card>.cu-item .state-info{position:absolute;top:15rpx;right:15rpx;}
</style>
